package com.ll.blog.contant;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

@AllArgsConstructor
@Getter
public enum BehaviorEnum {

    HOME_MODULE(0, "首页"),
    COMTENT_MODULE(1,"评论"),
    MESSAGE_MODULE(2,"留言"),
    ARTICLE_MODULE(3,"文章")
    ;
    @EnumValue
    private Integer value;
    @JsonValue
    private String desc;

    public static BehaviorEnum getEnumByvalue(Integer i){
        BehaviorEnum[] values = BehaviorEnum.values();
        for (BehaviorEnum behaviorEnum : values) {
            if (Objects.equals(behaviorEnum.value, i)) {
                return  behaviorEnum;
            }
        }
        return null;
    }
    public static Integer getValue(BehaviorEnum behaviorEnum){
        return behaviorEnum.value;
    }


}
